package com.edu.whty.common.constants;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

/**
 * 系统管理--常量值
 * @ClassName AdminConstant
 * @version v1.0 
 * @Info CJP 2014-11-7
 */
public class AdminConstant {
	/**
	 * 正常、已观看、已推送, 显示,已处理，已收藏
	 */
	public final static String STATE_NORMAL = "0";
	
	/**
	 * 删除、未观看、未推送, 不显示，未处理，未收藏
	 */
	public final static String STATE_DELETE = "1";
	
	/**
	 * 初始化密码
	 */
	public final static String DEFAULT_PWD = "123456";
	
	/**
	 * 性别:女
	 */
	public final static String GENDER_FEMALE = "0";
	
	/**
	 * 性别:男
	 */
	public final static String GENDER_MALE = "1";
	
	/**
	 * "sessionUser"会话用户信息
	 */
	public final static String SESSION_USER = "sessionUser";
	
	/**
	 * 用户类型-学生("0")
	 */
	public final static String UTYPE_STUDENT = "0";
	
	/**
	 * 用户类型-老师("1")
	 */
	public final static String UTYPE_TEACHER = "1";
	
	/**
	 * 用户类型-学校管理员("2")
	 */
	public final static String UTYPE_SCHOOL = "2";
	
	/**
	 * 用户类型-机构管理员("3")
	 */
	public final static String UTYPE_ORG = "3";
	
	/**
	 * 用户类型-超级管理员("4")
	 */
	public final static String UTYPE_SUPER = "4";
	
	/**
	 * 用户类型-家长("5")
	 */
	public final static String UTYPE_PARENT = "5";
	
	/**
	 * 用户来源-当前系统("0")
	 */
	public final static String USER_SOURCE_LOCAL = "0";
	
	/**
	 * 用户来源-云教育("1")
	 */
	public final static String USER_SOURCE_YUN = "1";
	/**
	 * 用户来源-点滴教育云 DDJYY("2")
	 */
	public final static String USER_SOURCE_DDJYY = "2";
	
	/**
	 *   会话用户权限树
	 */
	public final static String SESSION_USER_TREE = "treeSpan";
	
	private static Map<String,String> userTypeMap = null;
	
	public static Map<String,String> getUserTypeMap(){
		if(userTypeMap == null){
			userTypeMap = new HashMap<String, String>();
			userTypeMap.put("0","学生");
			userTypeMap.put("1","教师");
			userTypeMap.put("2","学校管理员");
			userTypeMap.put("3","机构管理员");
			userTypeMap.put("4","超级管理员");
			userTypeMap.put("5","家长");
		}
		return userTypeMap;
	}
	
	/**
	 * 临时视频格式map
	 */
	public static Map<String,String> getVideoTypeMap(){
		Map<String,String> videoType = new HashMap<String, String>();
		videoType.put("flv", "flv");
		videoType.put("mp4", "mp4");
		return videoType;
	}
	
	/**
	 * 软件新增或叫更新
	 */
	public final static String SOFT_ADD = "add";
	
	/**
	 * 软件删除
	 */
	public final static String SOFT_DELETE = "delete";
	
	/**
	 * 上学期--字符
	 */
	public final static String SEMESTER_LAST = "0";
	
	/**
	 * 上
	 */
	public final static String SEMESTER_LAST_CH = "上";
	
	/**
	 * 下学期--字符
	 */
	public final static String SEMESTER_NEXT = "1";
	
	/**
	 * 下
	 */
	public final static String SEMESTER_NEXT_CH = "1";
	
	
	/**
	 * 获取当前学期设置
	 * @return
	 */
	public static String getCurrentSemester(){
		Calendar cal = Calendar.getInstance();
		int month = cal.get(Calendar.MONTH);
		String semester = "上";
		if(month < 9 && month >=2 ){
			semester = "下";
		}
		return semester;
	}
	
	/**
	 * 课前导学微课-消息类型
	 */
	public final static String msg_type_weike = "0"; 
	
	/**
	 * 作业辅导-消息类型
	 */
	public final static String msg_type_tutorial = "1"; 
	
	/**
	 * 在线作业-消息类型
	 */
	public final static String msg_type_homework = "2"; 
	
	/**
	 * 电子教材-消息类型
	 */
	public final static String msg_type_tbook = "3"; 
	
	/**
	 * 获取推送消息体
	 * @param msgType
	 * @param teacherName
	 * @param sourceName
	 * @return
	 */
	public static String getPushMsgContent(String msgType,String teacherName,String sourceName){
		String msgContent = "";
		if(teacherName == null){
			teacherName = "您的";
		}
		msgContent += "["+teacherName+"老师]给亲发来了";
		if(msgType.equals(msg_type_weike)){
			msgContent +="[课前导学]";
		}else if(msgType.equals(msg_type_weike)){
			msgContent +="[作业辅导]";
		}else if(msgType.equals(msg_type_weike)){
			msgContent +="[在线作业]";
		}else if(msgType.equals(msg_type_weike)){
			msgContent +="[电子教材]";
		}else{
			msgContent +="[消息]";
		}
		if(sourceName != null){
			msgContent += "《"+sourceName+"》";
		}
		return msgContent;
	}
	
}
